package com.kws.merchant.controller;


import com.kws.merchant.domain.Target;
import com.kws.merchant.service.TargetService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import com.kws.common.core.domain.R;

import javax.annotation.Resource;
import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * 商家-指标(Target)表控制层
 *
 * @author yxy
 * @since 2024-11-04 11:39:02
 */
@RestController
@Api(tags = "商家-指标(Target)")
@RequestMapping("target")
public class TargetController {
    /**
     * 服务对象
     */
    @Resource
    private TargetService targetService;
 


    @PostMapping("/add")
    @ApiOperation(value = "新增指标")
    public R add(@RequestBody Target target) {
        return R.ok(targetService.save(target));
    }

    @GetMapping("/list")
    @ApiOperation(value = "列表")
    public R<List<Target>> list() {
        return R.ok(targetService.list());
    }


    @GetMapping("/getMerchantByList")
    @ApiOperation(value = "查询商家指标列表")
    public R<List<Target>> getMerchantByList() {
        return R.ok(targetService.getMerchantByList());
    }

    @PostMapping("/addMerchantTarget")
    @ApiOperation(value = "新增商家指标")
    public R addMerchantTarget(@RequestBody List<Long> idList) {
        return R.ok(targetService.addMerchantTarget(idList));
    }

}
